package cn.ac.iscas.preprocess;

import java.io.BufferedOutputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;

import cn.ac.iscas.chinesesegmentme.Tokenizer;

public class preprocess {
	public static void main(String[] args) throws IOException{
		FileReader reader = new FileReader(
		"data/pku_test_gold.utf8");
		BufferedReader br = new BufferedReader(reader);
		String line = null;
		PrintStream ps = new PrintStream(
	    new BufferedOutputStream(new FileOutputStream(
	            new File("data/pku_test_gold.utf8.new"))), true);
		System.setOut(ps);    
		while ((line = br.readLine()) != null) {
			String newline = line.replaceAll("  ", "|");
			String output = "";
			for (int i = 0; i < newline.length(); i++){
				output += newline.charAt(i) + " ";
			}
			System.out.println(output);
		}
		br.close();
		reader.close();
	}
}
